#ifndef GlobalsH
#define GlobalsH

  #define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code)&0x8000)?1 :0)
  #define KEY_UP(vk_code)   ((GetAsyncKeyState(vk_code)&0x8000)?0 :1)

  #define NOMASK 0
  #define MASK 1

  #define Xres   320
  #define Yres   240

  #define _free( x ) if ( x ){ free( x ); x = NULL; }

  #include <vcl.h>
  #include <stdlib.h>
  #include <string.h>
  #include <stdio.h>
  #include <conio.h>
  #include <dir.h>

  #ifndef quad
     typedef unsigned char  BYTE;
     typedef unsigned short WORD;
     typedef unsigned long quad;
  #endif

  typedef struct TMAPPER
  {
     WORD menu[80][80];
     WORD Ydim,
          Xdim,
          Ypos,
          Xpos;
  } TMAP;

  typedef struct TBOXER
  {
    int  x,
         y,
         w,
         h,
         xpos,
         ypos;
  } TBOX;

  extern bool iCanDraw;

  extern TBOX til;
  extern TBOX rat;
  extern TBOX col;
  extern TBOX chr;
  extern TBOX box;
  extern TMAP map;
  extern TMAP tile[2];
//  extern WORD ScrBuf[0x12C00];
//  extern WORD TleBuf[0x04000];
//  extern WORD MENU[2][0x10000];
//  extern WORD CTIL[0x10000];
  extern WORD *ScrBuf; //[0x12C00];
  extern WORD *TleBuf; //[0x04000];
  extern WORD *MENU[2];//[0x10000];
  extern WORD *CTIL;   //[0x10000];

  extern WORD copy[30][40];
  extern WORD cur_tile[64];
  extern BYTE mapf[260];
  extern BYTE tilf[2][260];
  extern BYTE exef[1024];
  extern char dirc[1024];  
  extern char buffer[MAXPATH];
  extern WORD cur_val;
  extern WORD add_val;  
  extern char cur_tle;

  extern Graphics::TBitmap *TEMP;
  extern long  lof[2];
  extern unsigned short DOS565[0x100];
  extern unsigned short LF[0x40]; 

  extern void memsetw(WORD *Dest, WORD Data , long lcSize);
  extern void memcpyw(WORD *Dest, WORD *Srce, long lcSize, char type);
  extern void MenuMap(WORD *Dest, TMAP *map, int Width, bool type );
  extern void puttile(WORD *Dest, WORD *Srce, char y, char x, int Width );
  extern char picrev(WORD *pic, char y, char x, char xy);
  extern long  _16To24( WORD value );
  extern long  FileSize( FILE *tf );    

  #include "TempGame.h"
  #include "Tiles.h"
  #include "MiniMap.h"
  #include "Real.h"
 

#endif
